package com.order.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.order.service.SentinelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version 1.0
 * @author: yu.tan
 * @date: 2020/10/25 17:30
 * @Description:
 */
@RestController
public class SentinelController {

    @Autowired
    private SentinelService sentinelService;

    @GetMapping("message1")
    public String testA(){
        return "message1";
    }


    @GetMapping("message2")
    public String testB(){
        return sentinelService.getMessage();
    }

    @GetMapping("message3")
    public String testC(){
        return sentinelService.getMessage();
    }


    @GetMapping("message4")
    @SentinelResource("message4")
    public String testD(String name,Integer age){
        return "message4:"+name+age;
    }


    @GetMapping("message5")
    @SentinelResource("message5")
    public String testE(String serviceName){
        return "message5:"+serviceName;
    }

    @GetMapping("message6")
    public String testF(){
        return sentinelService.getMessageA();
    }
}
